package com.hong.Config;

import com.hong.qrpc.TransportServer;
import com.hong.qrpc.constant.ProtoTypeConst;
import com.hong.qrpc.server.NettyTransportServer;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

/**
 * server配置，并为其赋默认值
 *
 * @Author HQT
 * @Date 2022/7/10 14:45
 */
@Slf4j
public class RpcServerConfig extends AbstractConfig {
    private int protocolType = ProtoTypeConst.QRPC;
    /**
     * 传输的服务对象
     */
    private Class<? extends TransportServer> transportClass = NettyTransportServer.class;
    /**
     * 默认端口为零(在bind的时候传入0会随机选择一个空闲端口)
     */
    private int port = 0;

    public RpcServerConfig() throws IOException {
    }

    public Class<? extends TransportServer> getTransportClass() {
        return transportClass;
    }

    public void setTransportClass(Class<? extends TransportServer> transportClass) {
        this.transportClass = transportClass;
    }

    public int getPort() {
        return this.port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getProtocolType() {
        return protocolType;
    }

    public void setProtocolType(int protocolType) {
        this.protocolType = protocolType;
    }
}
